home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
IRIX Base Documentation 1998 November
/
IRIX 6.5.2 Base Documentation November 1998.img
/
usr
/
share
/
catman
/
u_man
/
cat1
/
X11
/
makedepend.z
/
makedepend
Wrap
Text File
|
1998-10-30
|
14KB
|
265 lines
MMMMAAAAKKKKEEEEDDDDEEEEPPPPEEEENNNNDDDD((((1111)))) XXXX VVVVeeeerrrrssssiiiioooonnnn 11111111 ((((RRRReeeelllleeeeaaaasssseeee 6666....1111)))) MMMMAAAAKKKKEEEEDDDDEEEEPPPPEEEENNNNDDDD((((1111))))
NNNNAAAAMMMMEEEE
makedepend - create dependencies in makefiles
SSSSYYYYNNNNOOOOPPPPSSSSIIIISSSS
mmmmaaaakkkkeeeeddddeeeeppppeeeennnndddd [ ----DDDD_n_a_m_e====_d_e_f ] [ ----DDDD_n_a_m_e ] [ ----IIII_i_n_c_l_u_d_e_d_i_r ] [
----YYYY_i_n_c_l_u_d_e_d_i_r ] [ ----aaaa ] [ ----ffff_m_a_k_e_f_i_l_e ] [ ----oooo_o_b_j_s_u_f_f_i_x ] [
----pppp_o_b_j_p_r_e_f_i_x ] [ ----ssss_s_t_r_i_n_g ] [ ----wwww_w_i_d_t_h ] [ ----vvvv ] [ ----mmmm ] [ --
_o_t_h_e_r_o_p_t_i_o_n_s -- ] _s_o_u_r_c_e_f_i_l_e ...
DDDDEEEESSSSCCCCRRRRIIIIPPPPTTTTIIIIOOOONNNN
The mmmmaaaakkkkeeeeddddeeeeppppeeeennnndddd program reads each _s_o_u_r_c_e_f_i_l_e in sequence and
parses it like a C-preprocessor, processing all #_i_n_c_l_u_d_e,
#_d_e_f_i_n_e, #_u_n_d_e_f, #_i_f_d_e_f, #_i_f_n_d_e_f, #_e_n_d_i_f, #_i_f, #_e_l_i_f and
#_e_l_s_e directives so that it can correctly tell which
#_i_n_c_l_u_d_e, directives would be used in a compilation. Any
#_i_n_c_l_u_d_e, directives can reference files having other
#_i_n_c_l_u_d_e directives, and parsing will occur in these files
as well.
Every file that a _s_o_u_r_c_e_f_i_l_e includes, directly or
indirectly, is what mmmmaaaakkkkeeeeddddeeeeppppeeeennnndddd calls a _d_e_p_e_n_d_e_n_c_y. These
dependencies are then written to a _m_a_k_e_f_i_l_e in such a way
that mmmmaaaakkkkeeee((((1111)))) will know which object files must be recompiled
when a dependency has changed.
By default, mmmmaaaakkkkeeeeddddeeeeppppeeeennnndddd places its output in the file named
_m_a_k_e_f_i_l_e if it exists, otherwise _M_a_k_e_f_i_l_e. An alternate
makefile may be specified with the ----ffff option. It first
searches the makefile for the line
# DO NOT DELETE THIS LINE -- make depend depends on it.
or one provided with the ----ssss option, as a delimiter for the
dependency output. If it finds it, it will delete
everything following this to the end of the makefile and put
the output after this line. If it doesn't find it, the
program will append the string to the end of the makefile
and place the output following that. For each _s_o_u_r_c_e_f_i_l_e
appearing on the command line, mmmmaaaakkkkeeeeddddeeeeppppeeeennnndddd puts lines in the
makefile of the form
sourcefile.o: dfile ...
Where _s_o_u_r_c_e_f_i_l_e._o is the name from the command line with
its suffix replaced with ``.o'', and _d_f_i_l_e is a dependency
discovered in a #_i_n_c_l_u_d_e directive while parsing _s_o_u_r_c_e_f_i_l_e
or one of the files it included.
EEEEXXXXAAAAMMMMPPPPLLLLEEEE
Normally, mmmmaaaakkkkeeeeddddeeeeppppeeeennnndddd will be used in a makefile target so
that typing ``make depend'' will bring the dependencies up
to date for the makefile. For example,
Page 1 (printed 4/30/98)
MMMMAAAAKKKKEEEEDDDDEEEEPPPPEEEENNNNDDDD((((1111)))) XXXX VVVVeeeerrrrssssiiiioooonnnn 11111111 ((((RRRReeeelllleeeeaaaasssseeee 6666....1111)))) MMMMAAAAKKKKEEEEDDDDEEEEPPPPEEEENNNNDDDD((((1111))))
SRCS = file1.c file2.c ...
CFLAGS = -O -DHACK -I../foobar -xyz
depend:
makedepend -- $(CFLAGS) -- $(SRCS)
OOOOPPPPTTTTIIIIOOOONNNNSSSS
The program will ignore any option that it does not
understand so that you may use the same arguments that you
would for cccccccc((((1111))))....
----DDDD_n_a_m_e====_d_e_f or ----DDDD_n_a_m_e
Define. This places a definition for _n_a_m_e in
mmmmaaaakkkkeeeeddddeeeeppppeeeennnndddd''''ssss symbol table. Without =_d_e_f the symbol
becomes defined as ``1''.
----IIII_i_n_c_l_u_d_e_d_i_r
Include directory. This option tells mmmmaaaakkkkeeeeddddeeeeppppeeeennnndddd to
prepend _i_n_c_l_u_d_e_d_i_r to its list of directories to search
when it encounters a #_i_n_c_l_u_d_e directive. By default,
mmmmaaaakkkkeeeeddddeeeeppppeeeennnndddd only searches the standard include
directories (usually /usr/include and possibly a
compiler-dependent directory).
----YYYY_i_n_c_l_u_d_e_d_i_r
Replace all of the standard include directories with
the single specified include directory; you can omit
the _i_n_c_l_u_d_e_d_i_r to simply prevent searching the standard
include directories.
----aaaa Append the dependencies to the end of the file instead
of replacing them.
----ffff_m_a_k_e_f_i_l_e
Filename. This allows you to specify an alternate
makefile in which mmmmaaaakkkkeeeeddddeeeeppppeeeennnndddd can place its output.
Specifying ``-'' as the file name (i.e., ----ffff----) sends the
output to standard output instead of modifying an
existing file.
----oooo_o_b_j_s_u_f_f_i_x
Object file suffix. Some systems may have object files
whose suffix is something other than ``.o''. This
option allows you to specify another suffix, such as
``.b'' with -_o._b or ``:obj'' with -_o:_o_b_j and so forth.
----pppp_o_b_j_p_r_e_f_i_x
Object file prefix. The prefix is prepended to the
name of the object file. This is usually used to
designate a different directory for the object file.
The default is the empty string.
----ssss_s_t_r_i_n_g
Page 2 (printed 4/30/98)
MMMMAAAAKKKKEEEEDDDDEEEEPPPPEEEENNNNDDDD((((1111)))) XXXX VVVVeeeerrrrssssiiiioooonnnn 11111111 ((((RRRReeeelllleeeeaaaasssseeee 6666....1111)))) MMMMAAAAKKKKEEEEDDDDEEEEPPPPEEEENNNNDDDD((((1111))))
Starting string delimiter. This option permits you to
specify a different string for mmmmaaaakkkkeeeeddddeeeeppppeeeennnndddd to look for
in the makefile.
----wwww_w_i_d_t_h
Line width. Normally, mmmmaaaakkkkeeeeddddeeeeppppeeeennnndddd will ensure that
every output line that it writes will be no wider than
78 characters for the sake of readability. This option
enables you to change this width.
----vvvv Verbose operation. This option causes mmmmaaaakkkkeeeeddddeeeeppppeeeennnndddd to
emit the list of files included by each input file on
standard output.
----mmmm Warn about multiple inclusion. This option causes
mmmmaaaakkkkeeeeddddeeeeppppeeeennnndddd to produce a warning if any input file
includes another file more than once. In previous
versions of mmmmaaaakkkkeeeeddddeeeeppppeeeennnndddd this was the default behavior;
the default has been changed to better match the
behavior of the C compiler, which does not consider
multiple inclusion to be an error. This option is
provided for backward compatibility, and to aid in
debugging problems related to multiple inclusion.
-------- _o_p_t_i_o_n_s --------
If mmmmaaaakkkkeeeeddddeeeeppppeeeennnndddd encounters a double hyphen (--) in the
argument list, then any unrecognized argument following
it will be silently ignored; a second double hyphen
terminates this special treatment. In this way,
mmmmaaaakkkkeeeeddddeeeeppppeeeennnndddd can be made to safely ignore esoteric
compiler arguments that might normally be found in a
CFLAGS mmmmaaaakkkkeeee macro (see the EEEEXXXXAAAAMMMMPPPPLLLLEEEE section above). All
options that mmmmaaaakkkkeeeeddddeeeeppppeeeennnndddd recognizes and appear between
the pair of double hyphens are processed normally.
AAAALLLLGGGGOOOORRRRIIIITTTTHHHHMMMM
The approach used in this program enables it to run an order
of magnitude faster than any other ``dependency generator''
I have ever seen. Central to this performance are two
assumptions: that all files compiled by a single makefile
will be compiled with roughly the same -_I and -_D options;
and that most files in a single directory will include
largely the same files.
Given these assumptions, mmmmaaaakkkkeeeeddddeeeeppppeeeennnndddd expects to be called
once for each makefile, with all source files that are
maintained by the makefile appearing on the command line.
It parses each source and include file exactly once,
maintaining an internal symbol table for each. Thus, the
first file on the command line will take an amount of time
proportional to the amount of time that a normal C
preprocessor takes. But on subsequent files, if it
Page 3 (printed 4/30/98)
MMMMAAAAKKKKEEEEDDDDEEEEPPPPEEEENNNNDDDD((((1111)))) XXXX VVVVeeeerrrrssssiiiioooonnnn 11111111 ((((RRRReeeelllleeeeaaaasssseeee 6666....1111)))) MMMMAAAAKKKKEEEEDDDDEEEEPPPPEEEENNNNDDDD((((1111))))
encounters an include file that it has already parsed, it
does not parse it again.
For example, imagine you are compiling two files, _f_i_l_e_1._c
and _f_i_l_e_2._c, they each include the header file _h_e_a_d_e_r._h, and
the file _h_e_a_d_e_r._h in turn includes the files _d_e_f_1._h and
_d_e_f_2._h. When you run the command
makedepend file1.c file2.c
mmmmaaaakkkkeeeeddddeeeeppppeeeennnndddd will parse _f_i_l_e_1._c and consequently, _h_e_a_d_e_r._h and
then _d_e_f_1._h and _d_e_f_2._h. It then decides that the
dependencies for this file are
file1.o: header.h def1.h def2.h
But when the program parses _f_i_l_e_2._c and discovers that it,
too, includes _h_e_a_d_e_r._h, it does not parse the file, but
simply adds _h_e_a_d_e_r._h, _d_e_f_1._h and _d_e_f_2._h to the list of
dependencies for _f_i_l_e_2._o.
SSSSEEEEEEEE AAAALLLLSSSSOOOO
cc(1), make(1)
BBBBUUUUGGGGSSSS
mmmmaaaakkkkeeeeddddeeeeppppeeeennnndddd parses, but does not currently evaluate, the SVR4
#predicate(token-list) preprocessor expression; such
expressions are simply assumed to be true. This may cause
the wrong #_i_n_c_l_u_d_e directives to be evaluated.
Imagine you are parsing two files, say _f_i_l_e_1._c and _f_i_l_e_2._c,
each includes the file _d_e_f._h. The list of files that _d_e_f._h
includes might truly be different when _d_e_f._h is included by
_f_i_l_e_1._c than when it is included by _f_i_l_e_2._c. But once
mmmmaaaakkkkeeeeddddeeeeppppeeeennnndddd arrives at a list of dependencies for a file, it
is cast in concrete.
AAAAUUUUTTTTHHHHOOOORRRR
Todd Brunhoff, Tektronix, Inc. and MIT Project Athena
Page 4 (printed 4/30/98)